<!doctype html>
<html lang="en">
<head>
 @include('web.layout.head')
<link rel="stylesheet" href="{{mix('/css/web/shop/shop_header.css')}}">
<link rel="stylesheet" href="{{mix('/css/web/shop/shop.css')}}">
<title>121 - 供应产品</title>
</head>
<body class="por shop_1">
<div class="headerbox">
    @include('web.layout.product_head')
    @include('web.shop.top_nav')
</div>
<div class="company_tab_box">
    <div class="company_tab company_tab2" id="supply_glists" style="display:block">
        <div class="w1200" style="padding-bottom:6px;">
            <div class="products_classification_box">
                <ul>
                    <li class="classify">
                        <div class="left_box fl">
                            <div class="">分类：</div>
                        </div>
                        <div class="right_box fl">
                            @if(!empty($categories))
                                @foreach($categories as $k=>$v)
                                    <a class="{{$search['custom_cate']==$v['id']?'dq':''}}" href="/shop/products/{{$shop['sp_id']}}?third_cat={{$search['third_cat']}}&brand_id={{$search['brand_id']}}&custom_cate={{$v['id']}}">{{$v['name']}}</a>
                                @endforeach
                            @endif
                        </div>
                        @if(count($categories)>10)
                        <div class="more">更多∨</div>
                        @endif
                    </li>
                    <li class="category">
                        <div class="left_box fl">
                            <div class="">品类：</div>
                        </div>
                        <div class="right_box fl">
                            @foreach($product['categories'] as $k =>$v)
                                <a class="{{$search['third_cat']==$v['key']?'dq':''}}" href="/shop/products/{{$shop['sp_id']}}?third_cat={{$v['key']}}&brand_id={{$search['brand_id']}}&custom_cate={{$search['custom_cate']}}">{{$v['name']}}</a>

                                @endforeach
                        </div>
                        @if(count($product['categories'])>10)
                        <div class="more">更多∨</div>
                        @endif
                    </li>
                    <li class="brand">
                        <div class="left_box fl">
                            <div class="">品牌：</div>
                        </div>
                        <div class="right_box fl">
                            @foreach($product['brand'] as $k =>$v)
                                <a class="{{$search['brand_id']==$v['key']?'dq':''}}" href="/shop/products/{{$shop['sp_id']}}?third_cat={{$search['third_cat']}}&brand_id={{$v['key']}}&custom_cate={{$search['custom_cate']}}">{{$v['name']}}</a>

                                @endforeach
                        </div>

                        @if(count($product['brand'])>10)
                        <div class="more" >更多∨</div>
                        @endif
                    </li>
                </ul>
            </div>
            <form id="filter-form" action="">
            <div class="searchbox2 ">
                <div class="searchsbox fl">
                    <div class="wenzi fl">本店搜索</div>
                    <div class="inputbox fl">
                        <input type="text" placeholder="请输入产品名称" name="name" value="{{ isset($search['name'])?$search['name']:request('kw','') }}"/>
                    </div>
                    <div class="wenzi fl">价格</div>
                    <div class="inputbox inputbox2 fl">
                        <input type="number" name="price[start]" value="{{ isset($search['price']['start'])?$search['price']['start']:request('min_price','') }}"/>
                        <em>¥</em>
                    </div>
                    <div class="wenzi fl">-</div>
                    <div class="inputbox inputbox2 fl">
                        <input type="number" name="price[end]" value="{{ isset($search['price']['end'])?$search['price']['end']:request('max_price','') }}" />
                        <em>¥</em>
                    </div>
                    <input type="hidden" id="sort_ipt" />
                    <div class="submitbox fl">
                        <input type="submit" value="搜索" />
                    </div>
                </div>
            </div>
            </form>
            <div class="shopbox products_shopbox js-supply-goods">
                <ul style="width: 1240px;padding-bottom: 10px; min-height: 400px;">
                    @foreach($product['list'] as $k =>$v)
                    <li>
                        <div class="imgbox">
                            <a href="{{url('/product/info').'/'.$v['id'].'/'}}{{!empty($v['skus'])?$v['skus'][0]['id']:0}}" target="_blank">
                                <img src="{{$v['cover_image']}}" alt="{{$v['name']}}" />
                            </a>
                        </div>

                        <div class="wordbox">
                            <div class="price">¥ {{isset($v['skus'][0]['sale_price'])?$v['skus'][0]['sale_price']:'0.00'}}</div><div class="original_price">¥ {{isset($v['skus'][0]['price'])?$v['skus'][0]['price']:'0.00'}}</div>
                            <div class="shop_name">
                                <a href="{{url('/product/info').'/'.$v['id'].'/'}}{{!empty($v['skus'])?$v['skus'][0]['id']:0}}" target="_blank" title="">{{$v['name']}}</a>
                            </div>
                        </div>
                    </li>
                    @endforeach

                </ul>
                <div class="page">
                   @include('web.common.paginate', ['page' => $product['page']])
               </div>
            </div>
        </div>
    </div>
</div>
 @include('web.layout.footer_ware1')
</body>
</html>

<script type="text/javascript">
    $(function () {
        //input获得失去焦点效果
        $('input[type="text"]').focus(function () {
            $(this).addClass("active");
        })
        $('input[type="text"]').blur(function () {
            $(this).removeClass("active");
        })


        $('.filter-field').click(function () {
            var sort = $(this).data('field');
            if(sort == ''){
                $('#sort').val('');
            }else{
                var next = $(this).children().first();
                var  order = next.hasClass('up') ? 'down' : 'up';
                next.removeClass('up').removeClass('down').addClass(order);
                $('#sort').val(sort);
                $('#order').val(order == 'up' ? 'asc' : 'desc');
            }
            $('#filter-form').submit();
        });


        $('.category .more').click(function () {
            $(this).hide();
            $('.category').css('height','auto');
        })
        $('.brand .more').click(function () {
            $(this).hide();
            $('.brand').css('height','auto');
        })
        $('.classify .more').click(function () {
            $(this).hide();
            $('.classify').css('height','auto');
        })

//        var test = window.location.href;
//        //获取url中的参数
//        function getUrlParam(name) {
//            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
//            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
//            if (r != null) return unescape(r[2]); return null; //返回参数值
//        }
//        alert(getUrlParam('brand_id'));
//        alert(getUrlParam('third_cat'));
//        var xx = getUrlParam('reurl');


    })
</script>
